/// \file RendererDX9.h
/// \date 2012-12-05
/// \brief concrete class that offers the rendering and graphics device related functionality in DX9

#ifndef _SNAKE_RENDER_RENDERERDX9_H__
#define _SNAKE_RENDER_RENDERERDX9_H__

// DirectX9
#include <d3d9.h>
#include <D3dx9core.h>

#include <Render/Include/Renderer.h>
#include <Render/Include/IWinWindow.h>

namespace Render
{

/// \brief concrete class that offers the rendering and graphics device related functionality in DX9
class RendererDX9 : public Renderer
{
public:
    // ========== LIFECYCLE ========== //
    
    /// \brief Constructor
    RendererDX9(IWinWindow* window);

    /// \brief Destructor
    virtual ~RendererDX9();

    // ========== OVERLODED OPERATORS ========== //

    // ========== METHODS ========== //
        
    /// \brief concrete method to render a scene
    virtual void renderScene(Model::Scene* scene);
    
    /// \brief concrete method to render black image
    virtual void renderBlack();

    // ========== GETTERS ========== //

    // ========== SETTERS ========== //

    // ========== INQUIRY ========== //

private:
    // ========== INTERNAL METHODS ========== //
    
    /// \brief initializes a unitary cube
    void createCubeRenderObject();
    
    /// \brief initializes a unitary sphere
    void createSphereRenderObject();
    
    /// \brief configs the view point to do the rendering according to the scene
    void configViewPoint(Model::Scene* scene);

    /// \brief renders the scene walls
    void renderSceneWalls(Model::Scene* scene);

    /// \brief renders the snake head
    void renderSnakeHead(const Model::Element* &element);

    /// \brief renders the snake body element
    void renderSnakeBodyElement(const Model::Element* &element);
    
    /// \brief renders the text stored
    void drawText();
    
    // ========== ATTRIBUTES ========== //
    
    /// \brief directX9 device pointer
    LPDIRECT3DDEVICE9 p_device;

    /// \brief font to render text
    LPD3DXFONT font; 
};
};
#endif // _SNAKE_RENDER_RENDERERDX9_H__
